(defun factorial (n)
  (if (<= n 1) 1
      (* n (factorial (1- n)))))

;;; Number of combinations with repetition
;;; http://en.wikipedia.org/wiki/Combination
(defun combination-repetition (n k)
  (/ (factorial (1- (+ n k))) (factorial k) (factorial (1- n))))

;;; for each k*k grid, it means doing a Combination k from k+1 with repetition
(defun p15 ()
  (combination-repetition 21 20))

(format t "~a~%" (p15))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; solution in Pascal Triangle
;;; http://blog.functionalfun.net/2008/07/project-euler-problem-15-city-grids-and.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
